function divisor(n) {
    let tot = 0, m = Math.floor(Math.sqrt(n) + 0.5);
    for (let i = 1; i < m; i++) {
        if (n % i !== 0) continue;
        tot += 2;
    }
    if (m * m === n) tot++;
    return tot;
}

function divisibleTriangleNumber(n) {
    for (let i = 2; i <= 100000; i++) {
        if (divisor(i * (i + 1) / 2) >= n) {
            return i * (i + 1) / 2;
        }
    }
    return 1;
}

console.log(divisibleTriangleNumber(500));